package cn.ai.shoes.client.service;

import cn.ai.shoes.client.entity.ComfyuiQueueTask;
import com.alibaba.fastjson2.JSONObject;
import org.springframework.http.ResponseEntity;
import retrofit2.Response;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;

public interface ComfyuiService{
    /**
     * 获取图片路径
     * @param filename
     * @param type
     * @param subfolder
     * @return
     */
    public String getViewUrl(String serverId,String filename, String type, String subfolder);
    /**
     * 返回图片路径
     * @param historyResultBody
     * @param promptId
     * @return
     */
    public List<String> getViewUrlList(HashMap historyResultBody, String promptId, String currentServerUrl);
    /**
     * 保存图片
     * @param viewUrl
     * @param filename
     * @param type
     * @param subfolder
     */
    public void comfyuiLocalSaveImage(String viewUrl, String filename, String type, String subfolder);
    /**
     * 等待任务完成
     * @param promptId
     * @return
     */
    public HashMap waitingTask(String promptId,String currentServerUrl) throws IOException, InterruptedException;
    /**
     * 生成任务
     * @param prompt
     * @return
     */
    public String generateTask(JSONObject prompt,String currentServerUrl) throws IOException;
    /**
     * 生成图片
     * @param comfyuiQueTask
     * @return
     */
    public Response<HashMap> generateImages(ComfyuiQueueTask comfyuiQueTask,String currentServerUrl) throws IOException;
    /**
     * 回显视图
     * @return
     */
    ResponseEntity<byte[]> getView(String serverId,String filename, String type, String subfolder);

}
